import CrtptoJS from "crypto-js";

//  musse 8/16/32
const asekey: string = "24681012";

/**
 * 加密
 */
export const encrypt = (value: string, key: string = asekey) => {
	return CrtptoJS.AES.encrypt(value, CrtptoJS.enc.Utf8.parse(key), {
		mode: CrtptoJS.mode.ECB,
		padding: CrtptoJS.pad.Pkcs7,
	}).toString();
};

/**
 * 解密
 */
export const decrypt = (value: string, key: string = asekey) => {
	return CrtptoJS.AES.decrypt(value, CrtptoJS.enc.Utf8.parse(key), {
		mode: CrtptoJS.mode.ECB,
		padding: CrtptoJS.pad.Pkcs7,
	}).toString(CrtptoJS.enc.Utf8);
};
